function x = distToCoord(dist, prev)
% This function calculates coordinates from a distance matrix
firstTime = (nargin == 1);

number = size(dist);
number = number(1);

if(firstTime)
    x(1,:) = [0,0];
    x(2,:) = [dist(1,2),0];
    for i=3:number;
        % Cx = (AB^2+CA^2-BC^2) / (2*AB);
        % Cy = sqrt(CA^2-Cx^2);
        Cx = (dist(1,2)^2 + dist(1,i)^2 - dist(2,i)^2) / (2 * dist(1,2));
        Cy = real(sqrt(dist(1,i)^2 - Cx^2));
        x(i,:) = [Cx,Cy];
    end
else
    index = find(dist,-1);
    
    if(index < number-1)
        
    else
        
    end
end

end

